package cn.edu.nwafu.hjpg.service.impl;


import cn.edu.nwafu.hjpg.dao.*;
import cn.edu.nwafu.hjpg.entity.*;
import cn.edu.nwafu.hjpg.service.HjxwbService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HjxwbServiceImpl implements HjxwbService {
    final HjxwbDao hjxwbDao;

    public HjxwbServiceImpl(HjxwbDao hjxwbDao) {
        this.hjxwbDao = hjxwbDao;
    }

    @Override
    public Page<?> findAddRecordHjxwb(String flag, Pageable pageable) {
        return hjxwbDao.findAllByflag(flag,pageable);
    }

    @Override
    public List<Hjxwb> findByIdAndFlagInHjxwb(String id,String name,String flag) {
        return hjxwbDao.findElementByBaseinfoWzbmAndAttributeAndFlag(id,name,flag);
    }

    @Override
    public List<Hjxwb> findAll() {
        return hjxwbDao.findAll();
    }

    @Override
    public String updatehjxwb(Hjxwb hjxwb) {
        return hjxwbDao.save(hjxwb).getId();
    }

    @Override
    public String addHjxwgs(Hjxwb hjxwb) {
        return hjxwbDao.insert(hjxwb).getId();
    }

    @Override
    public String addSwjjbsq(Hjxwb hjxwb) {
        return hjxwbDao.insert(hjxwb).getId();
    }

    @Override
    public String addSwjj(Hjxwb hjxwb) {
        return hjxwbDao.insert(hjxwb).getId();
    }

    @Override
    public String addGjbsq(Hjxwb hjxwb) {
        return hjxwbDao.insert(hjxwb).getId();
    }

    @Override
    public String addQtjjxsm(Hjxwb hjxwb) {
        return hjxwbDao.insert(hjxwb).getId();
    }

    @Override
    public String addBcf(Hjxwb hjxwb) {
        return hjxwbDao.insert(hjxwb).getId();
    }

    @Override
    public String addBmf(Hjxwb hjxwb) {
        return hjxwbDao.insert(hjxwb).getId();
    }

    @Override
    public String addTmf(Hjxwb hjxwb) {
        return hjxwbDao.insert(hjxwb).getId();
    }

    @Override
    public String addBasf(Hjxwb hjxwb) {
        return hjxwbDao.insert(hjxwb).getId();
    }

    @Override
    public String addSwljxbz(Hjxwb hjxwb) {
        return hjxwbDao.insert(hjxwb).getId();
    }

    @Override
    public String addQthjxwxx(Hjxwb hjxwb) {
        return hjxwbDao.insert(hjxwb).getId();
    }

    @Override
    public String addupdateFlag(Hjxwb hjxwb) {
        return hjxwbDao.save(hjxwb).getId();
    }

    @Override
    public void deladdRecordhjxwb(Hjxwb hjxwb) {
        hjxwbDao.delete(hjxwb);
    }

    @Override
    public String addElement(Hjxwb hjxwb) {
        return hjxwbDao.insert(hjxwb).getBaseinfoWzbm();
    }

    @Override
    public Page<?> findByPageHjxwb(String id,String attribute, int flag, Pageable pageable) {
        return hjxwbDao.findAllByflagAndAttribute(id,attribute,flag,pageable);
    }


    @Override
    public List<Hjxwb> findAllByBaseinfoWzbmAndFlag(String id, String flag) {
        return  hjxwbDao.findAllByBaseinfoWzbmAndFlag(id,flag);
    }

    @Override
    public String addSjbsq(Hjxwb hjxwb) {
        return hjxwbDao.insert(hjxwb).getId();
    }


}

